/* User distinguish styles */
.ami-rich-message.user-message,
.message.user-message {
    margin-left: auto;
    margin-right: 0;
    max-width: 80%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(96, 165, 250, 0.2));
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: 12px;
    padding: 12px 16px;
    color: #f0f9ff;
    font-weight: 500;
    text-align: right; /* Changed to Right */
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    margin-bottom: 20px;
    border-right: 4px solid #60a5fa; /* Accent on right */
}

/* System messages - left-aligned */
.ami-rich-message:not(.user-message),
.message.system-message {
    margin-left: 0;
    margin-right: auto;
    max-width: 95%;
    margin-bottom: 16px;
}

/* User Text Color - Removed !important */
.ami-rich-message.user-message * {
    color: #e0f2fe;
}

.ami-rich-message.user-message .ami-p,
.ami-rich-message.user-message p {
    margin: 0;
    color: #e0f2fe;
    text-align: right;
}


/* Add visual separator between user and system */
.ami-rich-message.user-message::before {
    content: '👤 YOU';
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: rgba(147, 197, 253, 0.9);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: right; /* Label on Right */
}

/* Add AMI badge for system messages */
.ami-rich-message.answer::before {
    content: '🤖 AMI';
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: rgba(52, 211, 153, 0.7);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ami-rich-message.thought::before {
    content: '💭 THINKING';
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: rgba(251, 191, 36, 0.7);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ami-rich-message.sql::before {
    content: '⚙️ SQL';
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: rgba(52, 211, 153, 0.7);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Fallback for old message class structure */
.message.user-message {
    text-align: left;
    margin-left: auto;
}

.message.system-message {
    margin-left: 0;
    margin-right: auto;
}